/**
 * 添加或者修改页面
 */
var ScheduleAttendanceInfoDlg = {
    data: {
        storeName: "",
        plantDate: "",
        empName: "",
        actualHour: "",
        createTime: "",
        createUser: "",
        updateTime: "",
        updateUser: ""
    }
};

layui.use(['form', 'admin', 'ax','laydate'], function () {
    var $ = layui.jquery;
    var $ax = layui.ax;
    var form = layui.form;
    var admin = layui.admin;
    var laydate = layui.laydate;

    //让当前iframe弹层高度适应
    admin.iframeAuto();


    // laydate.render({
    //     elem: '#plantDate',
    //     type: 'date'
    //     ,format: 'yyyy年MM月dd日' //可任意组合
    //     ,trigger: 'click'
    //     ,done: function(value, date, endDate){
    //         console.log(value); //得到日期生成的值，如：2017-08-18
    //         console.log(date); //得到日期时间对象：{year: 2017, month: 8, date: 18, hours: 0, minutes: 0, seconds: 0}
    //         console.log(endDate); //得结束的日期时间对象，开启范围选择（range: true）才会返回。否则返回undefined
    //         $("#plantDate").val(value);
    //     }
    // });
    //表单提交事件
    form.on('submit(btnSubmit)', function (data) {
        var ajax = new $ax(Feng.ctxPath + "/scheduleAttendance/addItem", function (data) {
            Feng.success("添加成功！");
            window.location.href = Feng.ctxPath + '/scheduleAttendance'
        }, function (data) {
            Feng.error("添加失败！" + data.responseJSON.message)
        });
        ajax.set(data.field);
        ajax.start();

        return false;
    });

    //返回按钮
    $("#backupPage").click(function () {
        window.location.href = Feng.ctxPath + '/scheduleAttendance'
    });

});